Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] added CPU metrics to request diagnostics #179819

Merged
merged 6 commits into from
Apr 3, 2024

Conversation

juliaElastic
Copy link
Contributor

@juliaElastic juliaElastic commented Apr 2, 2024

Summary

Closes #162849

Added option to request agent diagnostics with CPU metrics. This is a new checkbox in Request diagnostics modal. When clicked, the action will contain a additional_metrics: ["CPU"].
Also replaced the click handler of Request diagnotics .zip button in Agent Details / Diagnostics tab, to open the same modal instead of immediately triggering the action.

To verify:

  • Enroll 2 agents with version 8.14-SNAPSHOT
  • Click on Agent diagnostics action in Agent list / Agent details
  • Verify that the CPU checkbox appears in the modal window
  • Verify that the diagnotics zip contains cpu.pprof file
  • Verify the same in bulk request diagnostics action when selecting 2 agents
image

Action created in .fleet-actions:

      {
        "_index": ".fleet-actions-7",
        "_id": "224e484f-fc49-4fba-989e-8ac30db29eff",
        "_score": 1,
        "_source": {
          "@timestamp": "2024-04-02T12:24:49.062Z",
          "expiration": "2024-04-02T12:27:49.062Z",
          "agents": [
            "b4a5d936-265c-40b1-be6a-d13ca91bed36"
          ],
          "action_id": "1fc01f99-c511-49bf-9350-96ddf537b562",
          "data": {
            "additional_metrics": [
              "CPU"
            ]
          },
          "type": "REQUEST_DIAGNOSTICS",
          "traceparent": "00-a5e3c645397964952efbeceed896e9db-03730cd3f6d60955-01"
        }
      },

Checklist

Delete any items that are not applicable to this PR.

@juliaElastic juliaElastic self-assigned this Apr 2, 2024
@juliaElastic
Copy link
Contributor Author

/ci

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@juliaElastic juliaElastic added release_note:enhancement backport:skip This commit does not require backporting labels Apr 2, 2024
@juliaElastic
Copy link
Contributor Author

@michel-laterman is this the right action format to request cpu metrics? When I tested, I didn't see any additional files in the diagnostics, should there be a cpu.pprof file?

   {
        "_index": ".fleet-actions-7",
        "_id": "224e484f-fc49-4fba-989e-8ac30db29eff",
        "_score": 1,
        "_source": {
          "@timestamp": "2024-04-02T12:24:49.062Z",
          "expiration": "2024-04-02T12:27:49.062Z",
          "agents": [
            "b4a5d936-265c-40b1-be6a-d13ca91bed36"
          ],
          "action_id": "1fc01f99-c511-49bf-9350-96ddf537b562",
          "data": {
            "additional_metrics": [
              "CPU"
            ]
          },
          "type": "REQUEST_DIAGNOSTICS"
        }
      },

@michel-laterman
Copy link

Looks correct, my e2e test is described in: elastic/fleet-server#3333 (comment)
the diagnostics bundle should contain a cpu.pprof file

@juliaElastic
Copy link
Contributor Author

Looks correct, my e2e test is described in: elastic/fleet-server#3333 (comment) the diagnostics bundle should contain a cpu.pprof file

Thanks, I realized it only works with an agent 8.14, not earlier. Tested with a 8.14 agent:

image

@juliaElastic juliaElastic marked this pull request as ready for review April 2, 2024 14:51
@juliaElastic juliaElastic requested review from a team as code owners April 2, 2024 14:51
@juliaElastic
Copy link
Contributor Author

/ci

Copy link
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code + UI LGTM 🚀

@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Apr 2, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

Copy link
Contributor

@kilfoyle kilfoyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the UI text! 👍

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
fleet 1.2MB 1.2MB -30.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
fleet 158.1KB 158.2KB +87.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @juliaElastic

@juliaElastic juliaElastic merged commit a5b13f3 into elastic:main Apr 3, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Allow collection CPU profiles when collecting agent diagnostics
8 participants